/*
1:下载vue-router   yarn add vue-router
2:导入与实例化
    import {createRouter,createWebHashHistory,createWebHistory} from 'vue-router'
    const router=createRouter({
        history:   
            hash:createWebHashHistory()
            history:createWebHistory(),
        routes:[
            {
                path,component...
            }
        ]
    })
3:暴露
   export default router
4:main.js导入与挂载注册
   import router from './router/index'
   const app=createApp(App)
   app.use(router)
5:路由出口
   <router-view />

6:路由跳转
   template:和以前完全一样
      router-link  to
      <button @click="$router.push(...)"></button>
   js文件：和以前完全一样
     import router from '...'
     router===this.$router
   .vue文件的script有变化
    import {useRouter,useRoute} from 'vue-router'
    const router=useRouter() 
       router====this.$router
    const route=useRoute()
       route===this.$route
7:路由传值：就二种
    query    
    动态路由匹配


*/

import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      component: () => import('../views/home.vue')
    },
    {
      path: '/user',
      component: () => import('../views/user.vue')
    }
  ]
})
export default router
